package com.frogs.ucenter.v1.request;

import javax.servlet.http.HttpServletRequest;

import com.frogs.framework.web.HttpRequestInfo;
import com.frogs.system.util.ApiUrlParamEnum;
import com.frogs.system.web.api.request.Request;
import com.frogs.system.web.exception.RequestIllegalException;

/**
 * 用户订单详细信息请求参数类
 *
 * @author wushubin
 */
public class UserOrderDetailRequest extends Request {

	/**
	 * 
	 */
	private static final long serialVersionUID = -1479827253640661761L;

	private int userId;
	
	private String orderSn;
	
	/** */
	public UserOrderDetailRequest() {
	}
	
	@Override
	public void parse(HttpServletRequest request) {
		
		HttpRequestInfo requestInfo = new HttpRequestInfo(request);
		
		this.userId = requestInfo.getIntParameter(ApiUrlParamEnum.userId.getParamName(), 0);
		this.orderSn = requestInfo.getParameter(ApiUrlParamEnum.orderSn.getParamName(),"-");
		if (userId < 1) {
			throw new RequestIllegalException("error userId: " + userId);
		}
		if (orderSn.equals("-")) {
			throw new RequestIllegalException("error orderSn: " + orderSn);
		}
		
	}

	public int getUserId() {
		return userId;
	}

	public void setUserId(int userId) {
		this.userId = userId;
	}

	public String getOrderSn() {
		return orderSn;
	}

	public void setOrderSn(String orderSn) {
		this.orderSn = orderSn;
	}
}
